



    Function.prototype.preventOverride= true; 
    


    Function.prototype.implementStatic= function ()
    {
      var accessor
      ,   trait
      ,   temp
      ,   i= 0
      ,   n= arguments.length
      ,   constructor= 'function' === typeof this ? this : this.constructor
      ,   prototype= constructor.prototype
      ,   preventOverride= constructor.preventOverride
      
      for (; i < n; i++)
      {
          trait= arguments[i];
          if ('function' === typeof trait) 
          {
              accessor= trait.getName();
              if (A === accessor)
                  continue;
                  
              if (preventOverride && accessor in this)
                  continue;

              if ('function' === typeof (temp= prototype[accessor])) 
              {
                  prototype[accessor]= function () 
                  {
                      if (arguments.length === trait.length)
                          return trait.apply(this, arguments);
                      
                      return temp
                  } 
              }
              else for (accessor in trait)
              {
                  if (preventOverride && accesor in prototype)
                      continue;
                      
                  prototype[accessor]= trait;
              }
          }
          
          // property names in objects are unique so overloading is not possible
          // without introducing an array syntax, which I won't do.
          for (accessor in trait) 
          {

          }    
      }; 
    };
    
    
    /*

var old = object[ name ];
    if ( old )
        object[ name ] = function(){
            if ( fn.length == arguments.length )
                return fn.apply( this, arguments );
            else if ( typeof old == 'function' )
                return old.apply( this, arguments );
        };
    else
        object[ name ] = fn;

    */
    
    Function.prototype.overload= function (newFunction, name)
    {
        if ('function' !== typeof newFunction) 
            return; // incorrect arguments
            
        if (null == name)
        {
            name= newFunction.getName();
            if (A === name) // the function is anonymous
                return; // can't name the method
        }
        
        var prototype= this.prototype
        ,   oldFunction= prototype[name]
        
        if ('function' !== typeof oldFunction)
        {
            
        }
            
        prototype[name]= function () 
        {
            if (arguments.length === newFunction.length)
                return newFunction.apply(this, arguments);
                
            return oldFunction.apply(this, arguments);
        };
        
       
    };
    
    
    
    
    
    
    
